package com.jswdwsx.esign.entity

import com.jswdwsx.esign.cloud.enums.SealEnum
import com.jswdwsx.esign.service.enums.SignFieldTypeEnum
import org.hibernate.annotations.DynamicInsert
import org.hibernate.annotations.DynamicUpdate
import org.hibernate.annotations.GenericGenerator
import org.hibernate.annotations.Parameter
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import javax.persistence.*

/**
 * @author jiangyuwen@jswdwsx.com
 * @version V1.0
 * @since 1.0 2019/7/15 15:48
 * @description 记录每个模板对应的签署区
 */

@Entity
@EntityListeners(AuditingEntityListener::class)
@DynamicInsert
@DynamicUpdate
@Table(name = "sign_field_template")
data class SignFieldTemplatePO(

    @Id
    @GeneratedValue(generator = "jpa-uuid")
    @GenericGenerator(name = "jpa-uuid", strategy = "uuid")
    var id: String? = null,
    /**
     * e签宝文件模板Id
     */
    @Column(name = "file_template_id")
    var fileTemplateId: String,

    /**
     * 签署流程模板id
     */
    @Column(name = "flow_template_id")
    var flowTemplateId: String,

    @Column(name = "type")
    @Enumerated(EnumType.STRING)
    var type: SignFieldTypeEnum,

    @Column(name = "order")
    var order: Int,

    @Column(name = "pos_page")
    var posPage: String,

    @Column(name = "pos_x")
    var posX: Float?,

    @Column(name = "pos_y")
    var posY: Float,

    @Column(name = "width")
    var width: Float?,

    @Column(name = "add_sign_time")
    var addSignTime: Boolean?,

    @Column(name = "seal_id")
    var sealId: String?,

    @Column(name = "input_seal_key")
    @Enumerated(EnumType.STRING)
    var inputSealKey: SealEnum? = null,       // 如果不为空，通过这个key获取入参中的印章id

    @Column(name = "sign_type")
    var signType: Int, //"签署类型， 1-单页签署，2-骑缝签署，默认1",

    @Column(name = "signer_account_id")
    var signerAccountId: String?,//"签署操作人个人账号标识，即操作本次签署的个人，如需e签宝通知用户签署，则系统向该账号下绑定的手机、邮箱发送签署链接",

    @Column(name = "actor_indentity_type")
    var actorIndentityType: String,// "签约主体类别，0-个人，2-机构；默认0,",

    @Column(name = "authorized_account_id")
    var authorizedAccountId: String?,// "签约主体账号标识，将使用该主体账号对应的数字证书完成本次签署，如：当存在签署操作人代某机构签署时，需要传入该机构的账号id； 默认是签署操作人本人作为签署主体签署"

    @Column(name = "assigned_pos_bean")
    var assignedPosBean: Boolean?,

    @Column(name = "seal_type")
    var sealType: String?
)